<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!doctype html>
<html>
<head>
    <%@ include file="/common/common.jsp" %>
    <title>我的账户</title>
    <script type="text/javascript" src="${ctx }/statics/libs/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${ctx }/statics/aui/css/aui.css"/>
    <!-- jquery wui -->
    <link rel="stylesheet" type="text/css" href="${ctx }/css/weui.min.css"/>
    <link rel="stylesheet" type="text/css" href="${ctx }/css/jquery-weui.css"/>
    <script src="${ctx }/js/jquery.min.js"></script>
    <script src="${ctx }/js/jquery-weui.min.js"></script>
    <script src="${ctx }/js/swiper.min.js"></script>
    <script src="${ctx }/js/city-picker.min.js"></script>
    <!-- jquery wui -->

    <style type="text/css">
        .receivables_text {
            font-family: PingFangSC-Regular;
            font-size: 15px;
            color: #666666;
            line-height: 30px;
            text-align: right;
        }

        #div1 {
            width: 60px;
            height: 30px;
            border-radius: 42px;
            position: relative;
        }

        #div2 {
            width: 26px;
            height: 26px;
            border-radius: 42px;
            position: absolute;
            background: white;
            box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.4);
            margin-top: 0px;
            margin-right: 0px;
        }

        .open1 {
            background: rgba(0, 184, 0, 0.8);
        }

        .open2 {
            top: 2px;
            right: 1px;
        }
    </style>
</head>
<body>
<section class="aui-content">
    <input type="hidden" id="openid" value="${openid}" name="openid">
    <input type="hidden" id="id" value="${cashiers.id}" name="id">
    <ul class="aui-list">

        <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title receivables_text">企业商户号</div>
                <div class="aui-list-item-right ">${merchant.merchantNo}</div>
            </div>
        </li>
        <li class="aui-list-item  aui-list-item-arrow">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title receivables_text">更换登录手机号</div>
                <div class="aui-list-item-right "><a href="changeMobile?id=${cashiers.id}"><span>${cashiers.mobilephone}</span></a></div>
            </div>
        </li>
        <li class="aui-list-item  aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title receivables_text">是否开启通知</div>
                <div class="aui-list-item-right ">
                    <div id="div1" class="open1">
                        <div id="div2" class="open2"></div>
                    </div>
                </div>
            </div>
        </li>

    </ul>
	
	<c:if test="${cashiers.role == 1}">
    <ul class="aui-list" style="border-top: 44px solid #dddddd;">

        <li class="aui-list-item  aui-list-item">
            <div class="aui-list-item-inner" onclick="location='viewMerInfo'">
                <div class="aui-list-item-title receivables_text">单位资料</div>
            </div>
        </li>
        <li class="aui-list-item  aui-list-item">
            <div class="aui-list-item-inner" onclick="location='viewSignInfo'">
                <div class="aui-list-item-title receivables_text">签约信息</div>
            </div>
        </li>
    </ul>
    </c:if>
    <ul class="aui-list" style="border-top: 44px solid #dddddd;">

        <li class="aui-list-item  aui-list-item authLogout">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title receivables_text">退出登录</div>
            </div>
        </li>
    </ul>
</section>

<script type="text/javascript">
    $('.authLogout').bind("click", function () {
        $.confirm({
            title: '确定要退出吗？',
            text: '',
            onOK: function () {
                location = '../auth/logout'
            },
            onCancel: function () {
            }
        });
    });


    $(function () {
        var isNotify = '${cashiers.isNotify}';

        var div2 = document.getElementById("div2");
        var div1 = document.getElementById("div1");

        if (isNotify == 0) {
            div1.className = "close1";
            div2.className = "close2";
        } else if (isNotify == 1) {
            div1.className = "open1";
            div2.className = "open2";
        }

        div2.onclick = function () {
            div1.className = (div1.className == "close1") ? "open1" : "close1";
            div2.className = (div2.className == "close2") ? "open2" : "close2";

            var id = $('#id').val();
            if (div2.className == "close2") {
                isNotify = 0;
            } else if (div2.className == "open2") {
                isNotify = 1;
            }
            $.ajax({
                type: "POST",
                url: "../auth/isNotify.do",
                data: {
                    id: id,
                    isNotify: isNotify,
                },
                success: function (result) {
                    var jsonObj = JSON.parse(result);
                    if (jsonObj.code != 0) {
                        alert(jsonObj.msg);
                    }
                    ;
                }
            });
        };
    });
</script>

</body>
</html>